package com.ddogring.business.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @BelongsProject: eshop
 * @BelongsPackage: com.ddogring.business.domain
 * @Author: DdogRing
 * @CreateTime: 2023-01-30  11:02
 * @Description: TODO
 * @Version: 1.0
 */
@Data
@TableName("t_order")
public class Order {

    /** 主键 */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /** 订单编号 */
    @NotNull(message = "订单编号不能为空")
    private String orderId;

    /** 商品id */
    @NotNull(message = "商品id")
    private Integer shopId;

    /** 1待处理 2已发货 3已收获 4待付款 5已取消 */
    private Integer status;

    /** 0未删除 1已删除 */
    @TableLogic(value = "0", delval = "1")
    @TableField(fill = FieldFill.INSERT)
    private Integer delFlag;

    /** 创建时间 */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 修改时间 */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 下单用户id */
    @NotNull(message = "下单用户不能为空")
    private Integer attributionId;

    /** 商家id */
    @NotNull(message = "商家不能为空")
    private Integer businessId;

    /** 订单金额 */
    private BigDecimal totalAmount;

    /** 商品名称 */
    @TableField(exist = false)
    private String commodity;

    /** 图片路径 */
    @TableField(exist = false)
    private String picture;

    /** 买家用户名 */
    @TableField(exist = false)
    private String attributionName;

    /** 卖家用户名 */
    @TableField(exist = false)
    private String businessName;

    @TableField(exist = false)
    private Integer pageNum;

    @TableField(exist = false)
    private Integer pageSize;

    public Integer pageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer pageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}